package com.ruoyi.biz.demo.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import com.ruoyi.biz.demo.mapper.BizPersonMapper;
import com.ruoyi.biz.demo.domain.BizPerson;
import com.ruoyi.biz.demo.service.IBizPersonService;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * 企业人员Service业务层处理
 *
 * @author Fei.Cong
 * @date 2024-06-05
 */
@Slf4j
@Service
public class BizPersonServiceImpl extends ServiceImpl<BizPersonMapper, BizPerson> implements IBizPersonService {

    @Autowired
    private BizPersonMapper bizPersonMapper;

    /**
     * 分页查询企业人员
     *
     * @param page
     * @param bizPerson 企业人员
     */
    @Override
    public IPage<BizPerson> pageList(BizPerson bizPerson, IPage<BizPerson> page) {
        return bizPersonMapper.selectPageList(page, bizPerson);
    }

    /**
     * 条件查询企业人员
     *
     * @param bizPerson 企业人员
     * @return
     */
    @Override
    public List<BizPerson> queryList(BizPerson bizPerson) {
        LambdaQueryWrapper<BizPerson> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.like(StringUtils.isNotBlank(bizPerson.getUserName()), BizPerson::getUserName, bizPerson.getUserName());
        return bizPersonMapper.selectList(lambdaQueryWrapper);
    }

}
